using UnityEngine;

//有这行生成的脚本都是UTF-8形式的
namespace MyGame
{
    public class BaseUI<T>  : MonoBehaviour where T : MonoBehaviour
    {
        public Vector3 initPosition;

        private static T instance;

        public static T Instance
        {
            get
            {
                if (instance == null)
                {
                    instance = FindObjectOfType<T>();
                }
                return instance;
            }
        }

        public UIType uIType;

        protected virtual void Awake()
        {
            initPosition = transform.position;
        }

        public virtual void Hide()
        {
            gameObject.SetActive(false);
        }

        public virtual void Show()
        {
            gameObject.SetActive(true);
        }

        public void Reduce()
        {
            transform.localScale = Vector3.zero;
        }

        public void Restore()
        {
            transform.localScale = Vector3.one;
        }

        public void RemovePosition()
        {
            transform.position = new Vector3(9999,9999);
        }

        public void InitPosition()
        {
            transform.position = initPosition;
        }
    }
}


